package com.app.signing.view.room

import android.os.Bundle
import com.app.signing.BuildConfig
import com.app.signing.app.logi
import com.app.signing.data.SpManager
import com.app.signing.view.login.LoginStates
import com.app.signing.view.room.data.RoomSeatData
import com.app.signing.view.room.data.SeatDataUtil
import com.app.signing.view.room.data.SeatType
import com.app.signing.view.room.view.OnSeatClickListener
import kotlinx.android.synthetic.main.activity_room212.view_room

class Room212Activity : BaseRoomActivity() {

    override fun initView(savedInstanceState: Bundle?) {
        super.initView(savedInstanceState)
        if (BuildConfig.PLAN == 2) {
            view_room.updateSeatData(RoomSeatData(6, 5, SeatType.seatYellow, "180"))
        }
    }

    override fun getRoomId(): String {
        return "212"
    }

    override fun buildData(): List<List<RoomSeatData>> {
        return SeatDataUtil.buildData(SeatDataUtil.ROOM_212)
    }

    override fun onSeatClickListener(): OnSeatClickListener {
        return OnSeatClickListener {
            "点击了座位--$it".logi()
            val statusId = SpManager.INSTANCE.readLoginStates()
            if (BuildConfig.PLAN == 2 && statusId == LoginStates.loginSpecial) {
                if (it.id == "180") {
                    showToast("该座位已被设置为常用座位")
                } else {
                    showToast("您的学习时长不够设置常用座位，请切换为普通座位模式")
                }
                return@OnSeatClickListener
            }
            signInSeat(it)
        }
    }
}
